package com.wyl.mq.consumer;

import cn.hutool.core.date.DateTime;
import com.rabbitmq.client.Channel;
import com.wyl.mq.config.TtlQueueConfig;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @author 吴宇亮 on 2023/6/9 14:13
 */
//@Component
public class TtlQueueConsumer {

    @RabbitListener(queues = TtlQueueConfig.ttlQueueOutput)
    public void receiveTtlQueue(Message message, Channel channel) {
        String msg = new String(message.getBody());
        System.out.println("当前时间：" + DateTime.now().toTimeStr() + ", 消费者收到消息： " + msg);
    }
}
